package com.briup.app01.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.briup.app01.bean.CstService;
import com.briup.app01.bean.CstServiceExample;
import com.briup.app01.bean.CstServiceExample.Criteria;
import com.briup.app01.dao.CstServiceMapper;
import com.briup.app01.service.CstServiceService;
@Service
public class CstServiceServiceImpl implements CstServiceService {
	@Autowired
	private CstServiceMapper serviceMapper;
	public void saveOrUpdate(CstService service) {
		if(service.getSvrId()==null) {
			serviceMapper.insertSelective(service);
		}else {
		       serviceMapper.updateByPrimaryKey(service);
	     }
	}
	public void deleteById(long id) {
		serviceMapper.deleteByPrimaryKey(id);
	}
	public CstService selectById(long id) {
		return serviceMapper.selectByPrimaryKey(id);
	}
	
	public List<CstService> select(String type, String title,String status) {
		CstServiceExample example = new CstServiceExample();
    	Criteria criteria = example.createCriteria();
    	if(type!=null) {
    		criteria.andSvrTypeLike("%"+type+"%");
    	}
    	if(title!=null) {
    		criteria.andSvrTitleLike("%"+title+"%");
    }
    	if(status!=null) {
    		criteria.andSvrStatusLike("%"+status+"%");
    	}
    		return serviceMapper.selectByExample(example);
	}
	
	}
	
	
	
	
	